﻿<UserControl x:Class="Esponce.Views.GenerateView"
  xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
  xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
  xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" 
  xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
	xmlns:m="clr-namespace:Esponce.Models"
	xmlns:v="clr-namespace:Esponce.Views"
	xmlns:control="clr-namespace:LoadingControl.Control"
  mc:Ignorable="d" d:DesignWidth="800" d:DesignHeight="400">
	<UserControl.DataContext>
		<m:GenerateViewModel />
	</UserControl.DataContext>
	<Grid x:Name="LayoutRoot">
		<Grid.ColumnDefinitions>
			<ColumnDefinition Width="363" />
			<ColumnDefinition Width="20" />
			<ColumnDefinition Width="*" />
		</Grid.ColumnDefinitions>

		<!-- Input parameters -->
		<Grid Grid.Column="0">
			<Grid.RowDefinitions>
				<RowDefinition Height="Auto" />
				<RowDefinition Height="10" />
				<RowDefinition Height="*" />
			</Grid.RowDefinitions>

			<TextBlock Grid.Row="0" Text="INPUT PARAMETERS" Style="{StaticResource TitleStyle}" />

			<Border Grid.Row="2" Style="{StaticResource BorderStyle}">
				<StackPanel Orientation="Vertical" Margin="20">

					<!-- Content -->
					<TextBlock Text="Content:" Grid.Column="0" VerticalAlignment="Center" Style="{StaticResource LabelStyle}" />
					<TextBox Grid.Column="1" Text="{Binding Content, Mode=TwoWay}" Margin="0,0,0,10" AcceptsReturn="True" Height="100" />

					<!-- Additional parameters -->
					<StackPanel Orientation="Horizontal" Margin="0,0,0,10">
						<StackPanel Orientation="Vertical" Margin="0,0,10,0">
							<TextBlock Text="Size: " VerticalAlignment="Center" Style="{StaticResource LabelStyle}" />
							<ComboBox SelectedIndex="{Binding SizeIndex, Mode=TwoWay}" Width="100">
								<ComboBoxItem Content="Default" />
								<ComboBoxItem Content="1" />
								<ComboBoxItem Content="2" />
								<ComboBoxItem Content="3" />
								<ComboBoxItem Content="4" />
								<ComboBoxItem Content="5" />
								<ComboBoxItem Content="6" />
								<ComboBoxItem Content="7" />
								<ComboBoxItem Content="8" />
								<ComboBoxItem Content="9" />
								<ComboBoxItem Content="10" />
								<ComboBoxItem Content="11" />
								<ComboBoxItem Content="12" />
								<ComboBoxItem Content="13" />
								<ComboBoxItem Content="14" />
								<ComboBoxItem Content="15" />
								<ComboBoxItem Content="16" />
								<ComboBoxItem Content="17" />
								<ComboBoxItem Content="18" />
								<ComboBoxItem Content="19" />
								<ComboBoxItem Content="20" />
							</ComboBox>
						</StackPanel>

						<StackPanel Orientation="Vertical" Margin="0,0,10,0">
							<TextBlock Text="Padding: " VerticalAlignment="Center" Style="{StaticResource LabelStyle}" />
							<ComboBox SelectedIndex="{Binding PaddingIndex, Mode=TwoWay}" Width="100">
								<ComboBoxItem Content="Default" />
								<ComboBoxItem Content="None" />
								<ComboBoxItem Content="1" />
								<ComboBoxItem Content="2" />
								<ComboBoxItem Content="3" />
								<ComboBoxItem Content="4" />
							</ComboBox>
						</StackPanel>

						<StackPanel Orientation="Vertical" Margin="0,0,0,0">
							<TextBlock Text="Version: " VerticalAlignment="Center" Style="{StaticResource LabelStyle}" />
							<ComboBox SelectedIndex="{Binding VersionIndex, Mode=TwoWay}" Width="100">
								<ComboBoxItem Content="Auto" />
								<ComboBoxItem Content="1" />
								<ComboBoxItem Content="2" />
								<ComboBoxItem Content="3" />
								<ComboBoxItem Content="4" />
								<ComboBoxItem Content="5" />
								<ComboBoxItem Content="6" />
								<ComboBoxItem Content="7" />
								<ComboBoxItem Content="8" />
								<ComboBoxItem Content="9" />
								<ComboBoxItem Content="10" />
								<ComboBoxItem Content="11" />
								<ComboBoxItem Content="12" />
								<ComboBoxItem Content="13" />
								<ComboBoxItem Content="14" />
								<ComboBoxItem Content="15" />
								<ComboBoxItem Content="16" />
								<ComboBoxItem Content="17" />
								<ComboBoxItem Content="18" />
								<ComboBoxItem Content="19" />
								<ComboBoxItem Content="20" />
								<ComboBoxItem Content="21" />
								<ComboBoxItem Content="22" />
								<ComboBoxItem Content="23" />
								<ComboBoxItem Content="24" />
								<ComboBoxItem Content="25" />
								<ComboBoxItem Content="26" />
								<ComboBoxItem Content="27" />
								<ComboBoxItem Content="28" />
								<ComboBoxItem Content="29" />
								<ComboBoxItem Content="30" />
								<ComboBoxItem Content="31" />
								<ComboBoxItem Content="32" />
								<ComboBoxItem Content="33" />
								<ComboBoxItem Content="34" />
								<ComboBoxItem Content="35" />
								<ComboBoxItem Content="36" />
								<ComboBoxItem Content="37" />
								<ComboBoxItem Content="38" />
								<ComboBoxItem Content="39" />
								<ComboBoxItem Content="40" />
							</ComboBox>
						</StackPanel>
					</StackPanel>

					<!-- Encoding mode and error correction -->
					<StackPanel Orientation="Horizontal" Margin="0,0,0,10">
						<StackPanel Orientation="Vertical" Margin="0,0,10,0">
							<TextBlock Text="Encoding: " VerticalAlignment="Center" Style="{StaticResource LabelStyle}" />
							<ComboBox SelectedIndex="{Binding EncodeModeIndex, Mode=TwoWay}" Width="100">
								<ComboBoxItem Content="Default" />
								<ComboBoxItem Content="Byte" />
								<ComboBoxItem Content="Numeric" />
								<ComboBoxItem Content="AlphaNumeric" />
							</ComboBox>
						</StackPanel>

						<StackPanel Orientation="Vertical" Margin="0,0,10,0">
							<TextBlock Text="Error Correct.: " VerticalAlignment="Center" Style="{StaticResource LabelStyle}" />
							<ComboBox SelectedIndex="{Binding ErrorCorrectionIndex, Mode=TwoWay}" Width="100">
								<ComboBoxItem Content="Default" />
								<ComboBoxItem Content="L" />
								<ComboBoxItem Content="M" />
								<ComboBoxItem Content="Q" />
								<ComboBoxItem Content="H" />
							</ComboBox>
						</StackPanel>

						<StackPanel Orientation="Vertical" Margin="0,0,10,0">
							<TextBlock Text="Shorten: " VerticalAlignment="Center" Style="{StaticResource LabelStyle}" />
							<ComboBox SelectedIndex="{Binding ShortenIndex, Mode=TwoWay}" Width="100">
								<ComboBoxItem Content="None" />
								<ComboBoxItem Content="goo.by" />
							</ComboBox>
						</StackPanel>
					</StackPanel>

					<!-- Colors -->
					<StackPanel Orientation="Horizontal" Margin="0,0,0,10">
						<StackPanel Orientation="Vertical" Margin="0,0,10,0">
							<TextBlock Text="Foreground: " VerticalAlignment="Center" Style="{StaticResource LabelStyle}" />
							<ComboBox ItemsSource="{Binding ColorList}" SelectedIndex="{Binding ForegroundIndex, Mode=TwoWay}" Width="100">
								<ComboBox.ItemTemplate>
									<DataTemplate>
										<StackPanel Orientation="Horizontal">
											<Border Width="10" Height="10" Background="{Binding Brush}" BorderBrush="Black" BorderThickness="1" Margin="0,0,7,0" VerticalAlignment="Center" Visibility="{Binding IsDefault, Converter={StaticResource VisibilityConverter}, ConverterParameter='Invert'}" />
											<TextBlock Text="{Binding Name}" />
										</StackPanel>
									</DataTemplate>
								</ComboBox.ItemTemplate>
							</ComboBox>
						</StackPanel>

						<StackPanel Orientation="Vertical" Margin="0,0,10,0">
							<TextBlock Text="Background: " VerticalAlignment="Center" Style="{StaticResource LabelStyle}" />
							<ComboBox ItemsSource="{Binding ColorList}" SelectedIndex="{Binding BackgroundIndex, Mode=TwoWay}" Width="100">
								<ComboBox.ItemTemplate>
									<DataTemplate>
										<StackPanel Orientation="Horizontal">
											<Border Width="10" Height="10" Background="{Binding Brush}" BorderBrush="Black" BorderThickness="1" Margin="0,0,7,0" VerticalAlignment="Center" Visibility="{Binding IsDefault, Converter={StaticResource VisibilityConverter}, ConverterParameter='Invert'}" />
											<TextBlock Text="{Binding Name}" />
										</StackPanel>
									</DataTemplate>
								</ComboBox.ItemTemplate>
							</ComboBox>
						</StackPanel>

						<StackPanel Orientation="Vertical">
							<TextBlock Text="Action: " VerticalAlignment="Center" Style="{StaticResource LabelStyle}" Width="100" />
							<Button x:Name="btnGenerate" Content="Generate" Click="btnGenerate_Click" FontWeight="Bold" Padding="7,0,7,2" Cursor="Hand" />
						</StackPanel>
					</StackPanel>

					<!-- Action buttons -->
					<!--<StackPanel Orientation="Horizontal" Margin="0,10,0,0">
						<Button Content="Generate" Click="btnGenerate_Click" FontWeight="Bold" Padding="7,0,7,2" Cursor="Hand" />
						<Button Content="Save" Click="btnSave_Click" Margin="10,0,0,0" Padding="7,0,7,2" Cursor="Hand" />
					</StackPanel>-->

				</StackPanel>
			</Border>
		</Grid>

		<!-- Result -->
		<Grid Grid.Column="2">

			<Grid.RowDefinitions>
				<RowDefinition Height="Auto" />
				<RowDefinition Height="10" />
				<RowDefinition Height="*" />
			</Grid.RowDefinitions>

			<TextBlock Grid.Row="0" Text="OUTPUT: QR CODE" Style="{StaticResource TitleStyle}" />

			<Border Grid.Row="2" Style="{StaticResource BorderStyle}">
				<Grid Margin="20">
					<!-- QR Code Preview -->
					<Image Source="{Binding ImageSource}" Stretch="None" HorizontalAlignment="Center" VerticalAlignment="Center" Opacity="{Binding PreviewOpacity}">
						<Image.ContextMenu>
							<ContextMenu>
								<MenuItem Header="Save" Click="btnSave_Click" />
							</ContextMenu>
						</Image.ContextMenu>
					</Image>

					<!-- Loading animation -->
					<control:LoadingAnimation HorizontalAlignment="Center" VerticalAlignment="Center" IsHitTestVisible="False" IsLoading="{Binding IsLoading}" Visibility="{Binding IsLoading, Converter={StaticResource VisibilityConverter}}" />
				</Grid>
			</Border>

		</Grid>

	</Grid>
</UserControl>
